﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   Layout = "~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/_LayoutList.cshtml";
   DTcms.Model.channel_site site = ViewData["site"] as DTcms.Model.channel_site;
   DTcms.Model.siteconfig config = ViewData["config"] as DTcms.Model.siteconfig;
   Article_ListController bc = ViewBag.BasePage as Article_ListController;
   DTcms.Model.article_category m = bc.model;
   ViewBag.Title = m.title + " - " + site.name;
   DataTable list = null;
   string channel = "goods";
   int category_id = int.Parse(ViewBag.CategoryId as string);
   int count = 0;
   string category_nav = bc.get_category_menu("goods_list", category_id);
   int pagesize = 20;
   int totalcount = 0;
   string pagelist = string.Empty;
   int page = int.Parse(ViewBag.Page as string);    
}
<div class="section clearfix">

  <div class="wrapper auto clearfix">
    <div class="curr-nav">当前位置：<a href="@bc.linkurl("index")">首页</a> &gt; <a href="@bc.linkurl("goods")">购物商城</a>@Html.Raw(category_nav)</div>
    
    <div class="screen-box">
      <dl>
        <dt>分类：</dt>
        <dd>
         @if(category_id==0){
         <a class="selected" href="@bc.linkurl("goods")">全部</a>
         }else{
         <a href="@bc.linkurl("goods")">全部</a>
         }
         @{ 
         DataTable categoryList = bc.get_category_child_list(channel,0);
         foreach(DataRow cdr in categoryList.Rows){
            if(category_id==Convert.ToInt32(cdr["id"])){
               <a class="selected" href="@bc.linkurl("goods_list",cdr["id"])">@cdr["title"]</a>
            }else{
               <a href="@bc.linkurl("goods_list",cdr["id"])">@cdr["title"]</a>
            }
         }
         }
        </dd>
      </dl>
      
    </div>
      
    <div class="img-list2">
      <ul>
        @{
        DataTable goodsList = bc.get_article_list(channel, category_id, pagesize, page, "status=0", out totalcount, out pagelist, "goods_list", category_id, "__id__");<!--取得一个分页DataTable-->
        foreach(DataRow gdr in goodsList.Rows){
        <li>
          <div class="wrap-box">
            <div class="img-box">
              <a title="@gdr["title"]" href="@bc.linkurl("goods_show",gdr["id"])">
                @if(@gdr["is_red"]=="1"){
                <div class="abs-txt">推荐</div>
                }
                <img src="@gdr["img_url"]" />
              </a>
            </div>
            <div class="info">
              <h3><a title="@gdr["title"]" href="@bc.linkurl("goods_show",gdr["id"])">@gdr["title"]</a></h3>
              <div class="col">
                <b>￥@gdr["sell_price"]</b>元
              </div>
              <div class="col">
                <i>库存：@gdr["stock_quantity"]件</i>
                市场价：<s>@gdr["market_price"]</s>
              </div>
            </div>
          </div>
        </li>
        }
        }
      </ul>
    </div>
    
    <!--页码列表-->
    <div class="page-box">
      <div class="digg">@Html.Raw(pagelist)</div>
    </div>
    <!--/页码列表-->
    
  </div>
</div>